// express框架页面
var express = require('express')
var app = express()
var http = require('http')
var httpServer = http.createServer(app)
// 处理vue单页面history路由问题
var history = require('connect-history-api-fallback')
app.use(history({
  index: './index.html'
}))
// 服务器端文件压缩
var compression = require('compression')
app.use(compression())
// 指向dist文件目录
app.use(express.static('./dist'))

var PORT = 8888

httpServer.listen(PORT, (err) => {
  if (err) {
    console.log(err)
    return
  }
  console.log('HTTP at http://localhost:' + PORT + '\n')
})
